Skip to content

Slice 1 (2/4): repository interface + in-memory & SQLite adapters - #2

Merged
tildesrc merged 1 commit into
mainfrom
slice1/02-persistence
Jun 15, 2026
Merged

Slice 1 (2/4): repository interface + in-memory & SQLite adapters#2
tildesrc merged 1 commit into
mainfrom
slice1/02-persistence

Conversation

@tildesrc

@tildesrc tildesrc commented Jun 12, 2026

Copy link
Copy Markdown
Contributor

Second of four stacked PRs for Slice 1. The persistence boundary.

  • panopticon.core.repository — the Repository ABC (interface, ADR 0001/0006) + shared integrity checks (append-only, consistent history).
  • InMemoryRepository + SqliteRepository (user_version migrations).
  • Contract tests run against both backends — proof the interface is backend-agnostic (ADR 0006).

Stacked on the core PR; base is slice1/01-core.

🤖 Generated with Claude Code

@tildesrc
tildesrc force-pushed the slice1/02-persistence branch from d6294a0 to f627a51 Compare June 12, 2026 17:34
@tildesrc
tildesrc force-pushed the slice1/02-persistence branch from f627a51 to 72324c3 Compare June 12, 2026 18:35
@tildesrc
tildesrc force-pushed the slice1/02-persistence branch from 72324c3 to f4b127f Compare June 12, 2026 19:02
@tildesrc tildesrc changed the title Slice 1 (2/4): repository port + in-memory & SQLite adapters Slice 1 (2/4): repository interface + in-memory & SQLite adapters Jun 12, 2026
@tildesrc
tildesrc force-pushed the slice1/02-persistence branch from f4b127f to 41d4b3a Compare June 12, 2026 19:07
@tildesrc
tildesrc force-pushed the slice1/02-persistence branch from 41d4b3a to 00a9d5b Compare June 12, 2026 21:17
@tildesrc
tildesrc force-pushed the slice1/02-persistence branch 2 times, most recently from 615c7be to 21fe057 Compare June 14, 2026 15:11
@tildesrc
tildesrc force-pushed the slice1/01-core branch 2 times, most recently from 19a9eca to 58db21b Compare June 14, 2026 15:25
@tildesrc
tildesrc force-pushed the slice1/02-persistence branch 2 times, most recently from f1fafbc to 61da990 Compare June 14, 2026 16:05
@tildesrc
tildesrc force-pushed the slice1/02-persistence branch from 61da990 to ffb1d50 Compare June 14, 2026 16:15
@tildesrc
tildesrc force-pushed the slice1/01-core branch 6 times, most recently from 7b5b92b to 18cda68 Compare June 14, 2026 17:07
@tildesrc
tildesrc force-pushed the slice1/02-persistence branch 2 times, most recently from 3865076 to bde155e Compare June 14, 2026 17:33
@tildesrc
tildesrc force-pushed the slice1/02-persistence branch from bde155e to 6af1447 Compare June 14, 2026 17:38
@tildesrc
tildesrc changed the base branch from slice1/01-core to main June 14, 2026 17:38
@tildesrc
tildesrc force-pushed the slice1/02-persistence branch from 6af1447 to 5d20b9e Compare June 14, 2026 18:06
Comment thread src/panopticon/taskservice/__init__.py Outdated
@tildesrc
tildesrc force-pushed the slice1/02-persistence branch 5 times, most recently from 784870d to 03fe50e Compare June 14, 2026 19:00
)


def _fulfil_current_promises(history_row: _HistoryRow, entry: HistoryEntry) -> None:

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this should be a method on _HistoryRow

@tildesrc
tildesrc force-pushed the slice1/02-persistence branch from 03fe50e to 729e5b3 Compare June 15, 2026 00:24
The persistence interface is `Store` (not `Repository`, which collided with the `Repo`
domain object). A SQLAlchemy-backed `SqlAlchemyStore` replaces the hand-rolled sqlite3 and
dict-based adapters; "in-memory" is just an in-memory SQLite engine (StaticPool), with
on-disk SQLite as the other tested backend.

- Translators, not ORM-bound core: the pure, frozen domain models stay untouched; the
  adapter's mutable row classes own to_domain/from_domain, and parent->child links are ORM
  relationships (selectin eager-load, cascade insert).
- Integrity enforced by the Store base via template methods: create_task/save_task run
  validate_task_consistency / validate_history_append_only and delegate raw persistence to
  _insert_task / _stored_history / _update_task, so an adapter can't skip the checks.
  _update_task only appends new entries and fulfils the current entry's promises in place.
- Reflective tests guard that rows and domain dataclasses can't drift. Schema via
  metadata.create_all; Alembic deferred (BACKLOG).

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@tildesrc
tildesrc force-pushed the slice1/02-persistence branch from 729e5b3 to 61f03c8 Compare June 15, 2026 00:33
@tildesrc
tildesrc merged commit 76fff8e into main Jun 15, 2026
1 check passed
@tildesrc
tildesrc deleted the slice1/02-persistence branch June 15, 2026 00:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant